package com.xuexi.api;

import com.easygo.utils.PageUtils;
import com.xuexi.easygo.pojo.Specification;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@FeignClient(value = "easygo-Specification-service")
public interface SpecificationClient {

    @RequestMapping("specification_add")
    Integer specification_add(@RequestParam(value = "spec_name") String spec_name,
                              @RequestParam(value = "option_name")  String[] option_name,
                              @RequestParam(value = "orders")  Integer[] orders);

    /**
     * 规格服务的后台
     * @param pageIndex
     * @param pageSize
     * @param spec_name
     * @return
     */
    @RequestMapping("specification_pages")
    PageUtils<Specification> specification_pages(
            @RequestParam(defaultValue = "1",required = false,value = "pageIndex") Integer pageIndex,
            @RequestParam(defaultValue = "5",required = false,value = "pageSize") Integer pageSize,
            @RequestParam(defaultValue = "", required = false,value = "spec_name") String spec_name);

    //更新的时候数据回显
    @RequestMapping("specification_getById")
    Map<String,Object> getSpecification(@RequestParam(value = "id") Integer id);

    @RequestMapping("/specification_update")
    Integer specification_update(@RequestParam(value = "id") Integer id,
                                        @RequestParam(value = "spec_name") String spec_name,
                                        @RequestParam(value = "option_name")String[] option_name,
                                        @RequestParam(value = "orders")Integer[] orders);
}
